package com.example.demo.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import com.example.demo.service.DemoService;
import com.example.entity.Users;
import com.github.pagehelper.PageHelper;
@RestController
public class DemoController {
	@Autowired
	private DemoService demoService;
	
	@GetMapping("/likeName")
	public List<Users> likeName(String name){
		/*
		 * 第一个参数是第几页
		 * 第二个参数是显示的条数
		 */
		//PageHelper.startPage(1,1);
		List<Users> list = demoService.likeName(name);
		return list;
	}
	@GetMapping("/getById")
	public Users getById(long id) {
		return demoService.getById(id);
	}
}
